package errcode

import "net/http"

// 成功响应
var Success = ErrorCode{0, "success", http.StatusOK}

// 通用错误码 (1000-1999)
var (
	InternalServerError = ErrorCode{1000, "internal server error", http.StatusInternalServerError}
	InvalidParams       = ErrorCode{1001, "invalid parameters", http.StatusBadRequest}
	Unauthorized        = ErrorCode{1002, "unauthorized", http.StatusUnauthorized}
	Forbidden           = ErrorCode{1003, "forbidden", http.StatusForbidden}
	NotFound            = ErrorCode{1004, "resource not found", http.StatusNotFound}
	DatabaseError       = ErrorCode{1005, "database operation failed", http.StatusInternalServerError}
	FileOperationError  = ErrorCode{1006, "file operation failed", http.StatusInternalServerError}
)

// 用户管理错误码 (2000-2999) - internal/usermanager
var (
	UserNotFound       = ErrorCode{2001, "user not found", http.StatusNotFound}
	InvalidCredentials = ErrorCode{2002, "invalid credentials", http.StatusUnauthorized}
	TokenExpired       = ErrorCode{2003, "token expired", http.StatusUnauthorized}
	InsufficientRole   = ErrorCode{2004, "insufficient role permissions", http.StatusForbidden}
)

// 系统配置错误码 (3000-3999) - internal/system
var (
	// Station管理 (3000-3099)
	StationNotFound          = ErrorCode{3001, "station not found", http.StatusNotFound}
	StationNameAlreadyExists = ErrorCode{3002, "station name already exists", http.StatusConflict}
	StationTypeInvalid       = ErrorCode{3003, "invalid station type", http.StatusBadRequest}
	StationInUse             = ErrorCode{3004, "station is in use", http.StatusConflict}

	// Part管理 (3100-3199)
	PartNotFound      = ErrorCode{3101, "part not found", http.StatusNotFound}
	PartAlreadyExists = ErrorCode{3102, "part already exists", http.StatusConflict}
	PartNameDuplicate = ErrorCode{3103, "part name already exists", http.StatusConflict}

	// Weld管理 (3200-3299)
	WeldNotFound      = ErrorCode{3201, "weld not found", http.StatusNotFound}
	WeldConfigInvalid = ErrorCode{3202, "invalid weld configuration", http.StatusBadRequest}
)

// 屏幕配置错误码 (4000-4999) - internal/screen
var (
	AreaNotFound      = ErrorCode{4001, "area not found", http.StatusNotFound}
	AreaNameExists    = ErrorCode{4002, "area name already exists", http.StatusConflict}
	InvalidAreaConfig = ErrorCode{4003, "invalid area configuration", http.StatusBadRequest}
	AreaImageMissing  = ErrorCode{4004, "area image missing", http.StatusBadRequest}
)
